"[]"
# 80%
class Solution:
    def solution(self , data ):
        # write code here
        stack = []
        count = 0
        for i in data:
            if i == "[":
                stack.append(i)
            if not stack and i == "]":
                stack.append(i)
            elif i == "]" and stack[-1] == "]":
                stack.append(i)
            print(stack)
            if i == "]" and stack[-1] == "[":
                stack.pop()
            print("stack after pop",stack)
            if i == ".":
                count = count + 1
        if len(stack) <= count:
            return True
        return False
input = "[].]]"
print(Solution().solution(input))